package com.swufestu.second;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class listChangeRate extends AppCompatActivity {
    private static final String TAG = "onItemClick";
    TextView country,result;
    EditText input;
    float rate,result1;
    String country1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list_change_rate);
        Intent intent = getIntent();
        Bundle bundle = intent.getExtras();
        rate = 100/Float.parseFloat(bundle.getString("rate"));
        country1 = bundle.getString("country");
        country = (TextView)findViewById(R.id.ShowCountry);
        input = (EditText)findViewById(R.id.ListinputRMB);

        Log.i(TAG, "change: rate:"+rate);

        country.setText(country1);
    }

    public void change(View btn){
        if(btn.getId()==R.id.ListChangebtn){
            float inputRMB =Float.parseFloat(input.getText().toString());
            result = (TextView)findViewById(R.id.ListChangerslt);
            result1 = inputRMB*rate;
            Log.i(TAG, "change: sesult:"+result1);
            result.setText(String.valueOf(result1));
        }

    }

}